<!-- 修改个人信息头部组件 -->
<template>
  <view class="navigation-bar">
    
    <view class="title">{{ title }}</view>
    <view class="right" @click="handleClickRight">{{ rightText }}</view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    leftText: {
      type: String,
      default: '返回'
    },
    rightText: {
      type: String,
      default: ''
    },
	item: {
		type: String,
		default: ''
	}
  },
  methods: {
    handleLeftClick() {
      uni.navigateBack();
    },
    handleClickRight() {
		const form=JSON.parse(this.item)
      uni.request({
      	url: 'http://127.0.0.1:17000/AppCoach/upSex',
      	method: 'POST',
      	data: {
			id:form.id,
      		coachSex: form.coachSex
      	},
      	success: function(res) {
      		if (res.data.code == 200) {
				uni.reLaunch({
				url:'/pages/coach/home/wode'
				})
      		} else {
      			uni.showModal({
      				title: "系统提示",
      				content: "系统繁忙",
      				showCancel: false,
      				confirmText: "确定"
      			});
      		}
      
      	},
      	fail: function(error) {
      		// 处理请求失败
      		console.error('请检查网络');
      	}
      })
    }
  }
};
</script>

<style>
/* 根据需求添加样式 */
.navigation-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  margin-top: 2vh;
  padding: 0 16px;
}

.left, .right {
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

.title {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}
</style>